package demo1;

abstract class Shape {
    public int a;
    Shape () {

    }
//    public void draw() {
//        System.out.println("画图形！");
//    }
    public void fun() {

    };
    public abstract void draw();
}
class Rect extends Shape {
    @Override
    public void draw() {
        System.out.println("画矩形！");
    }
}
//abstract class Rect extends Shape {
//
//}
//class B extends Rect {
//    @Override
//    public void draw() {
//        System.out.println("画矩形！");
//    }
//}
class Cycle extends Shape {
    @Override
    public void draw() {
        System.out.println("画圆！");
    }
}
class Flower extends Shape {
    @Override
    public void draw() {
        System.out.println("画花！");
    }
}
public class Test {
    public static void drawMap(Shape shape) {
        shape.draw();
    }

    public static void main(String[] args) {
        //Shape shape = new Shape();//抽象类不能实例化
        drawMap(new Rect());
        drawMap(new Cycle());
        drawMap(new Flower());

        Shape shape = new Rect();;
    }
}

